package examlab.polimorfismo;

import java.util.ArrayList;
import java.util.List;

class A {}

class B extends A {}

class C extends B {

    public static void main(String args[]) {
        //        List<? super B> ty = new ArrayList<A>();
        List<? super A> ty = new ArrayList<A>();
        ty.add(new A());
        ty.add(new B());
        ty.add(new C());

        List<? super Number> num = new ArrayList<Number>();
        num.add(new Integer(1));

        List<? extends Number> numInteger = new ArrayList<Integer>();
        List<? extends Number> numDouble = new ArrayList<Double>();

        List<? super Integer> asd = new ArrayList<Number>();

        asd.add(new Integer(1));

    }
}
//Which of the following statements are true about the given program? (Choose three)
//ALine-18 gives a compile time error.
//BLine-19 gives a compile time error.
//CLine-20 gives a compile time error.
//DLine-21 gives a compile time error.
//EWill compile, if line-18 is replaced with "List<? super A> ty=new ArrayList<A>();"
//FWill compile, if line-18 is replaced with "List<? extends B> ty=new ArrayList<A>();"
//GWill compile, if line-18 is replaced with "List<?> ty=new ArrayList<A>();"
//HWill compile, if line-18 is replaced with "List<A> ty=new ArrayList<A>();"
//IWill compile, if line-18 is replaced with "List<Object> ty=new ArrayList<A>();"
//
